home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_guile.idb / usr / freeware / include / libguile / __scm.h.z / __scm.h
Encoding:
C/C++ Source or Header  |  2002-07-08  |  19.0 KB  |  690 lines

  1. /* classes: h_files */
  2.  
  3. #ifndef SCM___SCM_H
  4. #define SCM___SCM_H
  5. /* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
  6.  * 
  7.  * This program is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; either version 2, or (at your option)
  10.  * any later version.
  11.  * 
  12.  * This program is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with this software; see the file COPYING.  If not, write to
  19.  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  20.  * Boston, MA 02111-1307 USA
  21.  *
  22.  * As a special exception, the Free Software Foundation gives permission
  23.  * for additional uses of the text contained in its release of GUILE.
  24.  *
  25.  * The exception is that, if you link the GUILE library with other files
  26.  * to produce an executable, this does not by itself cause the
  27.  * resulting executable to be covered by the GNU General Public License.
  28.  * Your use of that executable is in no way restricted on account of
  29.  * linking the GUILE library code into it.
  30.  *
  31.  * This exception does not however invalidate any other reasons why
  32.  * the executable file might be covered by the GNU General Public License.
  33.  *
  34.  * This exception applies only to the code released by the
  35.  * Free Software Foundation under the name GUILE.  If you copy
  36.  * code from other Free Software Foundation releases into a copy of
  37.  * GUILE, as the General Public License permits, the exception does
  38.  * not apply to the code that you add in this way.  To avoid misleading
  39.  * anyone as to the status of such modified files, you must delete
  40.  * this exception notice from them.
  41.  *
  42.  * If you write modifications of your own for GUILE, it is your choice
  43.  * whether to permit this exception to apply to your modifications.
  44.  * If you do not wish that, delete this exception notice.  */
  45.  
  46.  
  47. /* "What's the difference between _scm.h and __scm.h?"
  48.  
  49.    _scm.h is not installed; it's only visible to the libguile sources
  50.    themselves.
  51.  
  52.    __scm.h is installed, and is #included by <libguile.h>.  If both
  53.    the client and libguile need some piece of information, and it
  54.    doesn't fit well into the header file for any particular module, it
  55.    should go in __scm.h.  */
  56.  
  57.  
  58. /* {Compiler hints}
  59.  *
  60.  * The following macros are used to provide additional information for the
  61.  * compiler, which may help to do better error checking and code
  62.  * optimization.  A second benefit of these macros is, that they also provide
  63.  * additional information to the developers.
  64.  */
  65.  
  66. /* The macro SCM_NORETURN indicates that a function will never return.
  67.  * Examples:
  68.  *   1) int foo (char arg) SCM_NORETURN;
  69.  */
  70. #ifdef __GNUC__
  71. #define SCM_NORETURN __attribute__ ((noreturn))
  72. #else
  73. #define SCM_NORETURN
  74. #endif
  75.  
  76. /* The macro SCM_UNUSED indicates that a function, function argument or
  77.  * variable may potentially be unused.
  78.  * Examples:
  79.  *   1) static int unused_function (char arg) SCM_UNUSED;
  80.  *   2) int foo (char unused_argument SCM_UNUSED);
  81.  *   3) int unused_variable SCM_UNUSED;
  82.  */
  83. #ifdef __GNUC__
  84. #define SCM_UNUSED __attribute__ ((unused))
  85. #else
  86. #define SCM_UNUSED
  87. #endif
  88.  
  89.  
  90. /* {Supported Options}
  91.  *
  92.  * These may be defined or undefined.
  93.  */
  94.  
  95. /* Old async mechanism */
  96. /* #define GUILE_OLD_ASYNC_CLICK */
  97.  
  98. /* #define GUILE_DEBUG_FREELIST */
  99.  
  100. /* If the compile FLAG `SCM_CAUTIOUS' is #defined then the number of
  101.  * arguments is always checked for application of closures.  If the
  102.  * compile FLAG `SCM_RECKLESS' is #defined then they are not checked.
  103.  * Otherwise, number of argument checks for closures are made only when
  104.  * the function position (whose value is the closure) of a combination is
  105.  * not an ILOC or GLOC.  When the function position of a combination is a
  106.  * symbol it will be checked only the first time it is evaluated because
  107.  * it will then be replaced with an ILOC or GLOC.
  108.  */
  109. #undef SCM_RECKLESS
  110. #define SCM_CAUTIOUS
  111.  
  112. /* After looking up a local for the first time, rewrite the
  113.  * code graph, caching its position.
  114.  */
  115. #define MEMOIZE_LOCALS
  116.  
  117. /* All the number support there is.
  118.  */
  119. #define BIGNUMS
  120.  
  121. /* GC should relinquish empty cons-pair arenas. */
  122. /* cmm:FIXME look at this after done mangling the GC */
  123. /* #define GC_FREE_SEGMENTS */
  124.  
  125. /* Provide a scheme-accessible count-down timer that
  126.  * generates a pseudo-interrupt.
  127.  */
  128. #define TICKS
  129.  
  130.  
  131. /* Use engineering notation when converting numbers strings?
  132.  */
  133. #undef ENGNOT
  134.  
  135.  
  136. /* {Unsupported Options}
  137.  *
  138.  * These must be defined as given here.
  139.  */
  140.  
  141.  
  142. #define CCLO
  143.  
  144. /* Guile Scheme supports the #f/() distinction; Guile Lisp won't.  We
  145.    have horrible plans for their unification.  */
  146. #undef SICP
  147.  
  148.  
  149.  
  150. /* Random options (not yet supported or in final form). */
  151.  
  152. #define STACK_CHECKING
  153. #undef NO_CEVAL_STACK_CHECKING
  154.  
  155.  
  156.  
  157. /* What did the configure script discover about the outside world?  */
  158. #include "libguile/scmconfig.h"
  159.  
  160.  
  161.  
  162. /* {Debugging Options}
  163.  *
  164.  * These compile time options determine whether to include code that is only
  165.  * useful for debugging guile itself or C level extensions to guile.  The
  166.  * common prefix for all option macros of this kind is "SCM_DEBUG_".  It is
  167.  * guaranteed that a macro named SCM_DEBUG_XXX is defined to be either 0 or 1,
  168.  * i. e. there is no need to test for the undefined case.  This allows to use
  169.  * these definitions comfortably in macro code, as in the following example:
  170.  *   #define FOO do { if (SCM_DEBUG_XXX) bar(); else baz(); } while (0)
  171.  * Any sane compiler will remove the unused branch without any performance
  172.  * penalty for the resulting code.
  173.  *
  174.  * Note:  Some SCM_DEBUG_XXX options are not settable at configure time.
  175.  * To change the value of such options you will have to edit this header
  176.  * file or give suitable options to make, like:
  177.  *   make all CFLAGS="-DSCM_DEBUG_XXX=1 ..."
  178.  */
  179.  
  180.  
  181. /* The value of SCM_DEBUG determines the default for most of the not yet
  182.  * defined debugging options.  This allows, for example, to enable most of the
  183.  * debugging options by simply defining SCM_DEBUG as 1.
  184.  */
  185. #ifndef SCM_DEBUG
  186. #define SCM_DEBUG 0
  187. #endif
  188.  
  189. /* If SCM_DEBUG_CELL_ACCESSES is set to 1, cell accesses will perform
  190.  * exhaustive parameter checking:  It will be verified that cell parameters
  191.  * actually point to a valid heap cell.  Note:  If this option is enabled,
  192.  * guile will run about ten times slower than normally.
  193.  */
  194. #ifndef SCM_DEBUG_CELL_ACCESSES
  195. #define SCM_DEBUG_CELL_ACCESSES SCM_DEBUG
  196. #endif
  197.  
  198. /* If SCM_DEBUG_DEPRECATED is set to 1, deprecated code is not compiled.  This
  199.  * can be used by developers to get rid of references to deprecated code.
  200.  */
  201. #ifndef SCM_DEBUG_DEPRECATED
  202. #define SCM_DEBUG_DEPRECATED SCM_DEBUG
  203. #endif
  204.  
  205. /* If SCM_DEBUG_INTERRUPTS is set to 1, with every deferring and allowing of
  206.  * interrupts a consistency check will be performed.
  207.  */
  208. #ifndef SCM_DEBUG_INTERRUPTS
  209. #define SCM_DEBUG_INTERRUPTS SCM_DEBUG
  210. #endif
  211.  
  212. /* If SCM_DEBUG_PAIR_ACCESSES is set to 1, accesses to cons cells will be
  213.  * exhaustively checked.  Note:  If this option is enabled, guile will run
  214.  * slower than normally.
  215.  */
  216. #ifndef SCM_DEBUG_PAIR_ACCESSES
  217. #define SCM_DEBUG_PAIR_ACCESSES SCM_DEBUG
  218. #endif
  219.  
  220. /* If SCM_DEBUG_REST_ARGUMENT is set to 1, functions that take rest arguments
  221.  * will check whether the rest arguments are actually passed as a proper list.
  222.  * Otherwise, if SCM_DEBUG_REST_ARGUMENT is 0, functions that take rest
  223.  * arguments will take it for granted that these are passed as a proper list.
  224.  */
  225. #ifndef SCM_DEBUG_REST_ARGUMENT
  226. #define SCM_DEBUG_REST_ARGUMENT SCM_DEBUG
  227. #endif
  228.  
  229. /* Use this for _compile time_ type checking only, since the compiled result
  230.  * will be quite inefficient.  The right way to make use of this option is to
  231.  * do a 'make clean; make CFLAGS=-DSCM_DEBUG_TYPING_STRICTNESS=1', fix your
  232.  * errors, and then do 'make clean; make'.
  233.  */
  234. #ifndef SCM_DEBUG_TYPING_STRICTNESS
  235. #define SCM_DEBUG_TYPING_STRICTNESS 1
  236. #endif
  237.  
  238. /* If SCM_ENABLE_VCELLS is set to 1, a couple of functions that deal
  239.  * with vcells are defined for compatability reasons.  Supporting
  240.  * vcells reduces performance however.
  241.  *
  242.  * We use a dedicated macro instead of just SCM_DEBUG_DEPRECATED so
  243.  * that code the belongs to the `vcell' feature is easier to find.
  244.  */
  245. #define SCM_ENABLE_VCELLS !SCM_DEBUG_DEPRECATED
  246.  
  247.  
  248.  
  249. #ifdef HAVE_LONG_LONGS
  250.  
  251. /* Some auto-generated .h files contain unused prototypes
  252.  * that need these typedefs.
  253.  */
  254.  
  255. #if (SCM_DEBUG_DEPRECATED == 0)
  256. typedef long long long_long;
  257. typedef unsigned long long ulong_long;
  258. #endif
  259.  
  260. #endif /* HAVE_LONG_LONGS */
  261.  
  262.  
  263.  
  264. /* {Architecture and compiler properties}
  265.  *
  266.  * Guile as of today can only work on systems which fulfill at least the
  267.  * following requirements:
  268.  * - long ints have at least 32 bits.
  269.  *   Guile's type system is based on this assumption.
  270.  * - long ints consist of at least four characters.
  271.  *   It is assumed that cells, i. e. pairs of long ints, are eight character
  272.  *   aligned, because three bits of a cell pointer are used for type data.
  273.  * - sizeof (void*) == sizeof (long int)
  274.  *   Pointers are stored in SCM objects, and sometimes SCM objects are passed
  275.  *   as void*.  Thus, there has to be a one-to-one correspondence.
  276.  * - numbers are encoded using two's complement.
  277.  *   The implementation of the bitwise scheme level operations is based on
  278.  *   this assumption.
  279.  * - ... add more
  280.  */
  281.  
  282. #ifndef HAVE_PTRDIFF_T
  283. typedef long ptrdiff_t;
  284. #endif
  285.  
  286. #ifdef HAVE_LIMITS_H
  287. # include <limits.h>
  288. #endif
  289.  
  290. #ifdef CHAR_BIT
  291. # define SCM_CHAR_BIT CHAR_BIT
  292. #else
  293. # define SCM_CHAR_BIT 8
  294. #endif
  295.  
  296. #ifdef LONG_BIT
  297. # define SCM_LONG_BIT LONG_BIT
  298. #else
  299. # define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char))
  300. #endif
  301.  
  302. #ifdef UCHAR_MAX
  303. # define SCM_CHAR_CODE_LIMIT (UCHAR_MAX + 1L)
  304. #else
  305. # define SCM_CHAR_CODE_LIMIT 256L
  306. #endif
  307.  
  308.  
  309.  
  310. #ifdef STDC_HEADERS
  311. # include <stdlib.h>
  312. # if HAVE_SYS_TYPES_H
  313. #  include <sys/types.h>
  314. # endif
  315. # if HAVE_SYS_STDTYPES_H
  316. #  include <sys/stdtypes.h>
  317. # endif
  318. #  include <stddef.h>
  319. #endif /* def STDC_HEADERS */
  320.  
  321. #if (SCM_DEBUG_DEPRECATED == 0)
  322. # define scm_sizet size_t
  323. #endif
  324.  
  325.  
  326.  
  327. #include "libguile/tags.h"
  328.  
  329.  
  330. #ifdef vms
  331. # ifndef CHEAP_CONTINUATIONS
  332.    typedef int jmp_buf[17];
  333.    extern int setjump(jmp_buf env);
  334.    extern int longjump(jmp_buf env, int ret);
  335. #  define setjmp setjump
  336. #  define longjmp longjump
  337. # else
  338. #  include <setjmp.h>
  339. # endif
  340. #else                /* ndef vms */
  341. # ifdef _CRAY1
  342.     typedef int jmp_buf[112];
  343.     extern int setjump(jmp_buf env);
  344.     extern int longjump(jmp_buf env, int ret);
  345. #  define setjmp setjump
  346. #  define longjmp longjump
  347. # else                /* ndef _CRAY1 */
  348. #  include <setjmp.h>
  349. # endif                /* ndef _CRAY1 */
  350. #endif                /* ndef vms */
  351.  
  352. /* James Clark came up with this neat one instruction fix for
  353.  * continuations on the SPARC.  It flushes the register windows so
  354.  * that all the state of the process is contained in the stack. 
  355.  */
  356.  
  357. #ifdef sparc
  358. # define SCM_FLUSH_REGISTER_WINDOWS asm("ta 3")
  359. #else
  360. # define SCM_FLUSH_REGISTER_WINDOWS /* empty */
  361. #endif
  362.  
  363. /* If stack is not longword aligned then 
  364.  */
  365.  
  366. /* #define SHORT_ALIGN */
  367. #ifdef THINK_C
  368. # define SHORT_ALIGN
  369. #endif
  370. #ifdef MSDOS
  371. # define SHORT_ALIGN
  372. #endif
  373. #ifdef atarist
  374. # define SHORT_ALIGN
  375. #endif
  376.  
  377. #ifdef SHORT_ALIGN
  378. typedef short SCM_STACKITEM;
  379. #else
  380. typedef long SCM_STACKITEM;
  381. #endif
  382.  
  383.  
  384. #ifndef USE_THREADS
  385. #define SCM_CRITICAL_SECTION_START 
  386. #define SCM_CRITICAL_SECTION_END 
  387. #define SCM_THREAD_SWITCHING_CODE
  388. #endif
  389.  
  390. #ifdef GUILE_OLD_ASYNC_CLICK
  391. extern unsigned int scm_async_clock;
  392.  
  393. #define SCM_ASYNC_TICK \
  394. do { \
  395.   if (0 == --scm_async_clock) \
  396.     scm_async_click (); \
  397. } while(0)
  398. #else
  399. extern int scm_asyncs_pending_p;
  400.  
  401. #define SCM_ASYNC_TICK /*fixme* should change names */ \
  402. do { \
  403.   if (scm_asyncs_pending_p) \
  404.     scm_async_click (); \
  405. } while (0)
  406. #endif
  407.  
  408. #if (SCM_DEBUG_INTERRUPTS == 1)
  409. #include <stdio.h>
  410. #define SCM_CHECK_NOT_DISABLED \
  411.   do { \
  412.     if (scm_ints_disabled) \
  413.       fprintf(stderr, "ints already disabled (at %s:%d)\n", \
  414.               __FILE__, __LINE__); \
  415.   } while (0)
  416.  
  417. #define SCM_CHECK_NOT_ENABLED \
  418.   do { \
  419.     if (!scm_ints_disabled) \
  420.       fprintf(stderr, "ints already enabled (at %s:%d)\n", \
  421.               __FILE__, __LINE__); \
  422.   } while (0)
  423.  
  424. #else
  425. #define SCM_CHECK_NOT_DISABLED
  426. #define SCM_CHECK_NOT_ENABLED
  427. #endif
  428.  
  429.  
  430. /* Anthony Green writes:
  431.    When the compiler sees...
  432.        DEFER_INTS;
  433.        [critical code here]
  434.        ALLOW_INTS;
  435.    ...it doesn't actually promise to keep the critical code within the
  436.    boundries of the DEFER/ALLOW_INTS instructions. It may very well
  437.    schedule it outside of the magic defined in those macros.
  438.  
  439.    However, GCC's volatile asm feature forms a barrier over which code is
  440.    never moved. So if you add...
  441.        asm ("");
  442.    ...to each of the DEFER_INTS and ALLOW_INTS macros, the critical
  443.    code will always remain in place.  asm's without inputs or outputs
  444.    are implicitly volatile. */
  445. #ifdef __GNUC__
  446. #define SCM_FENCE asm /* volatile */ ("")
  447. #else
  448. #define SCM_FENCE
  449. #endif
  450.  
  451. #define SCM_DEFER_INTS \
  452. do { \
  453.   SCM_FENCE; \
  454.   SCM_CHECK_NOT_DISABLED; \
  455.   SCM_CRITICAL_SECTION_START; \
  456.   SCM_FENCE; \
  457.   scm_ints_disabled = 1; \
  458.   SCM_FENCE; \
  459. } while (0)
  460.  
  461.  
  462. #define SCM_ALLOW_INTS_ONLY \
  463. do { \
  464.   SCM_CRITICAL_SECTION_END; \
  465.   scm_ints_disabled = 0; \
  466. } while (0)
  467.  
  468.  
  469. #define SCM_ALLOW_INTS \
  470. do { \
  471.   SCM_FENCE; \
  472.   SCM_CHECK_NOT_ENABLED; \
  473.   SCM_CRITICAL_SECTION_END; \
  474.   SCM_FENCE; \
  475.   scm_ints_disabled = 0; \
  476.   SCM_FENCE; \
  477.   SCM_THREAD_SWITCHING_CODE; \
  478.   SCM_FENCE; \
  479. } while (0)
  480.  
  481.  
  482. #define SCM_REDEFER_INTS  \
  483. do { \
  484.   SCM_FENCE; \
  485.   SCM_CRITICAL_SECTION_START; \
  486.   ++scm_ints_disabled; \
  487.   SCM_FENCE; \
  488. } while (0)
  489.  
  490.  
  491. #define SCM_REALLOW_INTS \
  492. do { \
  493.   SCM_FENCE; \
  494.   SCM_CRITICAL_SECTION_END; \
  495.   SCM_FENCE; \
  496.   --scm_ints_disabled; \
  497.   SCM_FENCE; \
  498. } while (0)
  499.  
  500.  
  501. #define SCM_TICK \
  502. do { \
  503.   SCM_ASYNC_TICK; \
  504.   SCM_THREAD_SWITCHING_CODE; \
  505. } while (0)
  506.  
  507.  
  508.  
  509. /* Classification of critical sections
  510.  *
  511.  * When Guile moves to POSIX threads, it won't be possible to prevent
  512.  * context switching.  In fact, the whole idea of context switching is
  513.  * bogus if threads are run by different processors.  Therefore, we
  514.  * must ultimately eliminate all critical sections or enforce them by
  515.  * use of mutecis.
  516.  *
  517.  * All instances of SCM_DEFER_INTS and SCM_ALLOW_INTS should therefore
  518.  * be classified and replaced by one of the delimiters below.  If you
  519.  * understand what this is all about, I'd like to encourage you to
  520.  * help with this task.  The set of classes below must of course be
  521.  * incrementally augmented.
  522.  *
  523.  * MDJ 980419 <djurfeldt@nada.kth.se>
  524.  */
  525.  
  526. /* A sections
  527.  *
  528.  * Allocation of a cell with type tag in the CAR.
  529.  *
  530.  * With POSIX threads, each thread will have a private pool of free
  531.  * cells.  Therefore, this type of section can be removed.  But!  It
  532.  * is important that the CDR is initialized first (with the CAR still
  533.  * indicating a free cell) so that we can guarantee a consistent heap
  534.  * at all times.
  535.  */
  536.  
  537. #define SCM_ENTER_A_SECTION SCM_CRITICAL_SECTION_START
  538. #define SCM_EXIT_A_SECTION SCM_CRITICAL_SECTION_END
  539.  
  540.  
  541.  
  542. /** SCM_ASSERT
  543.  ** 
  544.  **/
  545.  
  546.  
  547. #ifdef SCM_RECKLESS
  548. #define SCM_ASSERT(_cond, _arg, _pos, _subr)
  549. #define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg)
  550. #define SCM_ASRTGO(_cond, _label)
  551. #else
  552. #define SCM_ASSERT(_cond, _arg, _pos, _subr) \
  553.     if (!(_cond)) \
  554.           scm_wrong_type_arg (_subr, _pos, _arg)
  555. #define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg) \
  556.     if (!(_cond)) \
  557.           scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg)
  558. #define SCM_ASRTGO(_cond, _label) \
  559.         if (!(_cond)) \
  560.           goto _label
  561. #endif
  562.  
  563. /*
  564.  * SCM_WTA_DISPATCH
  565.  */
  566.  
  567. /* Dirk:FIXME:: In all of the SCM_WTA_DISPATCH_* macros it is assumed that
  568.  * 'gf' is zero if uninitialized.  It would be cleaner if some valid SCM value
  569.  * like SCM_BOOL_F or SCM_UNDEFINED was chosen.
  570.  */
  571.  
  572. extern SCM scm_call_generic_0 (SCM gf);
  573.  
  574. #define SCM_WTA_DISPATCH_0(gf, subr)                    \
  575.   return (SCM_UNPACK (gf)                    \
  576.       ? scm_call_generic_0 ((gf))                \
  577.       : (scm_error_num_args_subr ((subr)), SCM_UNSPECIFIED))
  578. #define SCM_GASSERT0(cond, gf, subr) \
  579.   if (!(cond)) SCM_WTA_DISPATCH_0((gf), (subr))
  580.  
  581. extern SCM scm_call_generic_1 (SCM gf, SCM a1);
  582.  
  583. #define SCM_WTA_DISPATCH_1(gf, a1, pos, subr)            \
  584.   return (SCM_UNPACK (gf)                    \
  585.       ? scm_call_generic_1 ((gf), (a1))            \
  586.       : (scm_wrong_type_arg ((subr), (pos), (a1)), SCM_UNSPECIFIED))
  587. #define SCM_GASSERT1(cond, gf, a1, pos, subr) \
  588.   if (!(cond)) SCM_WTA_DISPATCH_1((gf), (a1), (pos), (subr))
  589.  
  590. extern SCM scm_call_generic_2 (SCM gf, SCM a1, SCM a2);
  591.  
  592. #define SCM_WTA_DISPATCH_2(gf, a1, a2, pos, subr)            \
  593.   return (SCM_UNPACK (gf)                        \
  594.       ? scm_call_generic_2 ((gf), (a1), (a2))            \
  595.       : (scm_wrong_type_arg ((subr), (pos),                \
  596.                  (pos) == SCM_ARG1 ? (a1) : (a2)),    \
  597.          SCM_UNSPECIFIED))
  598. #define SCM_GASSERT2(cond, gf, a1, a2, pos, subr) \
  599.   if (!(cond)) SCM_WTA_DISPATCH_2((gf), (a1), (a2), (pos), (subr))
  600.  
  601. extern SCM scm_apply_generic (SCM gf, SCM args);
  602.  
  603. #define SCM_WTA_DISPATCH_n(gf, args, pos, subr)                  \
  604.   return (SCM_UNPACK (gf)                          \
  605.       ? scm_apply_generic ((gf), (args))                  \
  606.       : (scm_wrong_type_arg ((subr), (pos),                  \
  607.                  scm_list_ref ((args),              \
  608.                            SCM_MAKINUM ((pos) - 1))), \
  609.          SCM_UNSPECIFIED))
  610. #define SCM_GASSERTn(cond, gf, args, pos, subr) \
  611.   if (!(cond)) SCM_WTA_DISPATCH_n((gf), (args), (pos), (subr))
  612.  
  613. #ifndef SCM_MAGIC_SNARFER
  614. /* Let these macros pass through if
  615.    we are snarfing;  thus we can tell the
  616.    difference between the use of an actual
  617.    number vs. the use of one of these macros --
  618.    actual numbers in SCM_VALIDATE_* and SCM_ASSERT
  619.    constructs must match the formal argument name,
  620.    but using SCM_ARG* avoids the test */
  621.  
  622. #define SCM_ARGn         0
  623. #define SCM_ARG1         1
  624. #define SCM_ARG2         2
  625. #define SCM_ARG3         3
  626. #define SCM_ARG4         4
  627. #define SCM_ARG5         5
  628. #define SCM_ARG6         6
  629. #define SCM_ARG7         7 
  630.  
  631. #if (SCM_DEBUG_DEPRECATED == 0)
  632.  
  633. /* Use SCM_WRONG_NUM_ARGS instead of: */
  634. #define SCM_WNA         8
  635.  
  636. /* Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of: */
  637. #define SCM_OUTOFRANGE         10
  638.  
  639. /* Use scm_memory_error instead of: */
  640. #define SCM_NALLOC             11
  641.  
  642. #define SCM_HUP_SIGNAL         14
  643. #define SCM_INT_SIGNAL         15
  644. #define SCM_FPE_SIGNAL         16
  645. #define SCM_BUS_SIGNAL         17
  646. #define SCM_SEGV_SIGNAL        18
  647. #define SCM_ALRM_SIGNAL        19
  648. #define SCM_GC_SIGNAL          20
  649. #define SCM_TICK_SIGNAL        21
  650. #define SCM_SIG_ORD(X)         ((X) - SCM_HUP_SIGNAL)
  651. #define SCM_ORD_SIG(X)         ((X) + SCM_HUP_SIGNAL)
  652. #define SCM_NUM_SIGS           (SCM_SIG_ORD (SCM_TICK_SIGNAL) + 1)
  653.  
  654. #endif  /* SCM_DEBUG_DEPRECATED == 0 */
  655.  
  656. #endif /* SCM_MAGIC_SNARFER */
  657.  
  658.  
  659.  
  660. /* SCM_EXIT_SUCCESS is the default code to return from SCM if no errors
  661.  * were encountered.  SCM_EXIT_FAILURE is the default code to return from
  662.  * SCM if errors were encountered.  The return code can be explicitly
  663.  * specified in a SCM program with (scm_quit <n>).
  664.  */
  665.  
  666. #ifndef SCM_EXIT_SUCCESS
  667. #ifdef vms
  668. #define SCM_EXIT_SUCCESS 1
  669. #else
  670. #define SCM_EXIT_SUCCESS 0
  671. #endif /* def vms */
  672. #endif /* ndef SCM_EXIT_SUCCESS */
  673. #ifndef SCM_EXIT_FAILURE
  674. #ifdef vms
  675. #define SCM_EXIT_FAILURE 2
  676. #else
  677. #define SCM_EXIT_FAILURE 1
  678. #endif /* def vms */
  679. #endif /* ndef SCM_EXIT_FAILURE */
  680.  
  681.  
  682.  
  683. #endif  /* SCM___SCM_H */
  684.  
  685. /*
  686.   Local Variables:
  687.   c-file-style: "gnu"
  688.   End:
  689. */
  690.